import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

export default new Router({
    routes: [
        {
            //重定向
            path: '*',
            redirect: '/login'
        },
        {
            path: '/login',
            name: 'login',
            component: ()=>import('@/view/login/login')
        },
        {
            path: '/404',
            name: 'lose',
            component: ()=>import('@/view/login/lose')
        },
        {
            path: '/home1',
            name: 'home1',
            component: ()=>import('@/view/home/home1')
        },
        {
            path: '/index',
            name: 'index',
            component: ()=>import('@/index'),
            redirect:{name:'home'},
            children:[
                {
                    path: '/home',
                    name: 'home',
                    component: ()=>import('@/view/home/home')
                },
                {
                    path: '/monite',
                    name: 'monite',
                    component: ()=>import('@/view/monite/index'),
                    redirect:{name:'home'},
                    children:[
                        {
                            path: '/monite/1',
                            name: 'm1',
                            component: ()=>import('@/view/monite/1')
                        },
                        {
                            path: '/monite/2',
                            name: 'm2',
                            component: ()=>import('@/view/monite/2')
                        }
                    ]
                },
                {//用户管理
                    path: '/userManage',
                    name: 'userManage',
                    component: ()=>import('@/view/userManage/index')
                },
                {//权限管理
                    path: '/auth',
                    name: 'auth',
                    component: ()=>import('@/view/auth/index'),
                    redirect:{name:'auth'},
                    children:[
                        {
                            path: '/auth/user',
                            name: 'a1',
                            component: ()=>import('@/view/auth/user')
                        },
                        {
                            path: '/auth/api',
                            name: 'a2',
                            component: ()=>import('@/view/auth/api')
                        },
                        {
                            path: '/auth/add',
                            name: 'a3',
                            component: ()=>import('@/view/auth/add')
                        },
                        {
                            path: '/auth/auth',
                            name: 'a4',
                            component: ()=>import('@/view/auth/auth')
                        }
                    ]
                },
                {//工程管理
                    path: '/engineeringManage',
                    name: 'engineeringManage',
                    component: ()=>import('@/view/engineeringManage/index')
                },
                {
                    path: '/report',
                        name: 'report',
                    component: ()=>import('@/view/report/index'),
                    redirect:{name:'report'},
                    children:[
                        {
                            path: '/report/index',
                            name: 'index',
                            component: ()=>import('@/view/report/history')
                        },
                        {
                            path: '/report/now',
                                name: 'report',
                            component: ()=>import('@/view/report/now')
                        }
                ]
                },{
                    path: '/videoControl',
                    name: 'index',
                    component: ()=>import('@/view/videoControl/index'),
                    redirect:{name:'map'},
                    children:[
                        {
                            path: '/videoControl/map',
                            name: 'map',
                            component: ()=>import('@/view/videoControl/map')
                        },
                        {
                            path: '/videoControl/list',
                            name: 'list',
                            component: ()=>import('@/view/videoControl/list')
                        },
                        {
                            path: '/videoControl/show/:id',
                                name: 'show',
                            component: ()=>import('@/view/videoControl/show')
                        }
                ]
                },
                {//个人信息
                    path: '/my',
                    name: 'my',
                    component: ()=>import('@/view/my/index')
                },
                {
                    path: '/history',
                    name: 'history',
                    component: ()=>import('@/view/history/index'),
                    redirect:{name:'history'},
                    children:[
                        {
                            path: '/history/1',
                            name: 'h1',
                            component: ()=>import('@/view/history/1')
                        },
                        {
                            path: '/history/2',
                            name: 'h2',
                            component: ()=>import('@/view/history/2')
                        }
                    ]
                },
                {
                    path: '/system',
                    name: 'system',
                    component: ()=>import('@/view/system/index'),
                    redirect:{name:'system'},
                    children:[
                        {
                            path: '/system/log',
                            name: 'log',
                            component: ()=>import('@/view/system/log')
                        }
                    ]
                }
            ]
        }
    ]
})
